package com.csxy.chy.controller;

import com.csxy.chy.R;
import com.csxy.chy.service.OssService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Tag(name = "oss",description = "上传文件接口")
@RestController
@RequestMapping("/edu_oss/fileoss")
public class OssController {
    @Autowired
    private OssService ossService;
    @Operation(summary = "上传文件")
    @PostMapping("/upload")
    public R uploadFile(@RequestParam (name = "file")MultipartFile file){
        String url = ossService.uploadFileAvatar(file);
        return R.ok().data("url",url).message("上传成功");

    }
}
